<template>
  <el-dialog v-model="visible" title="产品详情" width="600">
    <el-form :model="detailData" label-width="100px">
      <el-form-item label="产品ID">
        <el-input v-model="detailData.id" readonly />
      </el-form-item>
      <el-form-item label="产品名称">
        <el-input v-model="detailData.name" readonly />
      </el-form-item>
      <el-form-item label="产品时间">
        <el-input v-model="detailData.data" readonly />
      </el-form-item>
      <el-form-item label="产品总价格">
        <el-input v-model="detailData.zongprice" readonly />
      </el-form-item>

    </el-form>
    <template #footer>
      <div class="dialog-footer">
        <el-button @click="close">关闭</el-button>
      </div>
    </template>
  </el-dialog>
</template>

<script setup>
import { ref, reactive } from 'vue'

const visible = ref(false)
const detailData = reactive({
  id: '',
  name: '',
  num: '',
  price: ''
})

// 显示详情弹窗
const showDetail = (data) => {
  Object.assign(detailData, data)
  visible.value = true
}

// 关闭弹窗
const close = () => {
  visible.value = false
}

defineExpose({
  showDetail
})
</script>